import Vue from 'vue'
import App from './App.vue'
import router from './router'
import store from './store'
import http from '@/libs/http'
import { isAuth } from '@/libs/auth'
import { ResultMessage } from "@/libs/response"
import * as filters from '@/libs/filters'
import PubSub from 'pubsub-js'



import '@/assets/styles/index.scss'
import '@/assets/styles/layout.scss'

import Screenfull from "screenfull";
import VueI18n from 'vue-i18n'
import ElementUI from 'element-ui'
import 'element-ui/lib/theme-chalk/index.css'

import '@/assets/iconfont/iconfont.css'
import '@/assets/styles/fonts.scss'

// Element UI i18n 国际化
import enLocale from 'element-ui/lib/locale/lang/en'
import zhLocale from 'element-ui/lib/locale/lang/zh-CN'
import en from '@/i18n/en'
import zh from '@/i18n/zh'

// 注册全局过滤器
Object.keys(filters).forEach(key => {
    Vue.filter(key, filters[key])
})

// 国际化
Vue.use(VueI18n)
const i18n = new VueI18n({
  locale: 'zh',
  messages: {
    en: Object.assign(en, enLocale),
    zh: Object.assign(zh, zhLocale)
  },
})
Vue.use(ElementUI, {
  i18n: (key, value) => i18n.t(key, value)
})

/**
 * 全局属性
 */
Vue.prototype.$Screenfull = Screenfull
Vue.prototype.$http = http
Vue.prototype.isAuth = isAuth
Vue.prototype.ResultMessage = ResultMessage
Vue.prototype.$echarts = window.echarts
Vue.prototype.PubSub = PubSub

Vue.config.productionTip = false
new Vue({
  router,
  store,
  i18n,
  render: h => h(App)
}).$mount('#app')
